package com.fadadianqi.goods.dao.ibatis;

import com.fadadianqi.commons.GenericDAOSuport;
import com.fadadianqi.goods.dao.PropValueDAO;
import com.fadadianqi.goods.model.PropValue;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class PropValueDAOImpl extends GenericDAOSuport<String, PropValue> implements PropValueDAO {

    @Override
    protected Class<?> getObjectClass() {
        return PropValue.class;
    }

    @Override
    protected String getTableName() {
        return "category_properties_values";
    }

    @Override
    public PropValue getByPropIdAndName(String propId, String name) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("propId", propId);
        map.put("name", name);
        return super.getByPropertys(map);
    }

    @Override
    public List<PropValue> findPropValues(String propId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("propId", propId);
        return super.findByPropertys(map);
    }

    @Override
    public void removeByPropId(String propId) {
        super.removeByProperty("propId", propId);
    }


}
